const initState = () => {
    return {
        newPasswordData: {
            isShow: false,
            cardTransition: "",
            title: "New Password",
            desc: "Please supply a new password for your Enchi account.",
            btn: "Done",
            realEmail: "",
            password: {
                title: "New Password: ",
                placeholder: "Password",
                tip: "Please enter your password.",
                // asyncTip: "Incorrect password.", //动态校验提示
                value: "",
                name: "password",
                type: "password",
            },
            verifyPassword: {
                title: "Verify Password: ",
                placeholder: "Password",
                tip: "Please enter your verify password.",
                asyncTip: "The two passwords don’t match, please try again.", //动态校验提示
                value: "", //输入框的值
                name: "password", //正则名称
                type: "password",
            },
        },
    };
};

const state = initState();

const mutations = {
    //打开新密码弹窗
    openNewPasswordPop(state, type) {
        state.newPasswordData.cardTransition = type ? type : 'contentLeaveRotate';
        state.newPasswordData.isShow = true;
    },

    //关闭新密码弹窗
    closeNewPasswordPop(state, type) {
        state.newPasswordData.cardTransition = type ? type : 'contentEnterRotate';
        state.newPasswordData.isShow = false;
        setTimeout(() => {
            this.commit('newPassword/resetState');
        });
    },
    resetState(state) {
        Object.assign(state, initState());
    }
};

const actions = {};

const getters = {};

export default {
    namespaced: true,
    state,
    getters,
    mutations,
    actions
};